<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
	xmlns:vmain="main.br.org.indt.ndg.ui.view.main.*"
	xmlns:vSurveyDetail="main.br.org.indt.ndg.ui.view.main.surveyDetails.*">

	<mx:Script>
		<![CDATA[
			private function changeView():void{
				if (viewStack.selectedIndex == 1 && listResults !== null){
					listResults.listResultsFirstPage(listSurveys.getSelectedSurvey());
				} else if (viewStack.selectedIndex == 2 && detailsSurvey != null){
					detailsSurvey.listResultsFirstPage(listSurveys.getSelectedSurvey());
				}
			}
			private function creationResults():void{
				listResults.listResultsFirstPage(listSurveys.getSelectedSurvey());
			}
			private function creationDetails():void{
				detailsSurvey.listResultsFirstPage(listSurveys.getSelectedSurvey());
			}
		]]>
	</mx:Script>
	
    <mx:Dissolve id="dissolveOut" duration="500" alphaFrom="1.0" alphaTo="0.0"/>
    <mx:Dissolve id="dissolveIn" duration="500" alphaFrom="0.0" alphaTo="1.0"/>
    
    
	<mx:ViewStack id="viewStack" change="changeView()">
		<!-- List of Surveys -->
		<mx:VBox hideEffect="{dissolveOut}" showEffect="{dissolveIn}">
			<vmain:ListSurveys id="listSurveys" myStack="{viewStack}"/>
		</mx:VBox>
		<!-- List of Results -->
		<mx:HBox hideEffect="{dissolveOut}" showEffect="{dissolveIn}">
			<vmain:ListResults id="listResults" myStack="{viewStack}"
				creationComplete="creationResults()"/>
		</mx:HBox>
		<!-- List of Details -->
		<mx:HBox hideEffect="{dissolveOut}" showEffect="{dissolveIn}">
			<vSurveyDetail:SurveyDetails id="detailsSurvey" myStack="{viewStack}"
				creationComplete="creationDetails()"/>
		</mx:HBox>
	</mx:ViewStack>	

	
</mx:Module>
